﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace EnterpriseFund.DAL
{
    /// <summary>
    /// 数据访问类:DJ_YHXX
    /// </summary>
    public partial class DJ_YHXX
    {
        public DJ_YHXX()
        { }
        #region  BasicMethod

        public DataSet GetCboList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"SELECT a.NSRDZDAH,a.YHZH,b.YH_MC FROM  ltais.DJ_YHXX a 
LEFT JOIN ltais.DM_YH b ON a.YH_DM=b.YH_DM AND a.YHZL_DM = b.YHZL_DM");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public EnterpriseFund.Model.DJ_YHXX DataRowToModel(DataRow row)
        {
            EnterpriseFund.Model.DJ_YHXX model = new EnterpriseFund.Model.DJ_YHXX();
            if (row != null)
            {
                if (row["XH"] != null && row["XH"].ToString() != "")
                {
                    model.XH = decimal.Parse(row["XH"].ToString());
                }
                if (row["NSRDZDAH"] != null && row["NSRDZDAH"].ToString() != "")
                {
                    model.NSRDZDAH = decimal.Parse(row["NSRDZDAH"].ToString());
                }
                if (row["YHZL_DM"] != null)
                {
                    model.YHZL_DM = row["YHZL_DM"].ToString();
                }
                if (row["YH_DM"] != null)
                {
                    model.YH_DM = row["YH_DM"].ToString();
                }
                if (row["YHZH"] != null)
                {
                    model.YHZH = row["YHZH"].ToString();
                }
                if (row["KLRQ"] != null && row["KLRQ"].ToString() != "")
                {
                    model.KLRQ = DateTime.Parse(row["KLRQ"].ToString());
                }
                if (row["YHKLLB_DM"] != null)
                {
                    model.YHKLLB_DM = row["YHKLLB_DM"].ToString();
                }
                if (row["YXBZ"] != null)
                {
                    model.YXBZ = row["YXBZ"].ToString();
                }
                if (row["YSLWBZ"] != null)
                {
                    model.YSLWBZ = row["YSLWBZ"].ToString();
                }
                if (row["NSR_SWJG_DM"] != null)
                {
                    model.NSR_SWJG_DM = row["NSR_SWJG_DM"].ToString();
                }
                if (row["SWJG_DM"] != null)
                {
                    model.SWJG_DM = row["SWJG_DM"].ToString();
                }
                if (row["LRR_DM"] != null)
                {
                    model.LRR_DM = row["LRR_DM"].ToString();
                }
                if (row["LRRQ"] != null && row["LRRQ"].ToString() != "")
                {
                    model.LRRQ = DateTime.Parse(row["LRRQ"].ToString());
                }
                if (row["XGR_DM"] != null)
                {
                    model.XGR_DM = row["XGR_DM"].ToString();
                }
                if (row["XGRQ"] != null && row["XGRQ"].ToString() != "")
                {
                    model.XGRQ = DateTime.Parse(row["XGRQ"].ToString());
                }
                if (row["JKFS_DM"] != null)
                {
                    model.JKFS_DM = row["JKFS_DM"].ToString();
                }
                if (row["BGRQ"] != null && row["BGRQ"].ToString() != "")
                {
                    model.BGRQ = DateTime.Parse(row["BGRQ"].ToString());
                }
                if (row["ZXRQ"] != null && row["ZXRQ"].ToString() != "")
                {
                    model.ZXRQ = DateTime.Parse(row["ZXRQ"].ToString());
                }
                if (row["BZ"] != null)
                {
                    model.BZ = row["BZ"].ToString();
                }
                if (row["SFJKZH"] != null)
                {
                    model.SFJKZH = row["SFJKZH"].ToString();
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select XH,NSRDZDAH,YHZL_DM,YH_DM,YHZH,KLRQ,YHKLLB_DM,YXBZ,YSLWBZ,NSR_SWJG_DM,SWJG_DM,LRR_DM,LRRQ,XGR_DM,XGRQ,JKFS_DM,BGRQ,ZXRQ,BZ,SFJKZH ");
            strSql.Append(" FROM DJ_YHXX ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperOra.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" XH,NSRDZDAH,YHZL_DM,YH_DM,YHZH,KLRQ,YHKLLB_DM,YXBZ,YSLWBZ,NSR_SWJG_DM,SWJG_DM,LRR_DM,LRRQ,XGR_DM,XGRQ,JKFS_DM,BGRQ,ZXRQ,BZ,SFJKZH ");
            strSql.Append(" FROM DJ_YHXX ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperOra.Query(strSql.ToString());
        }

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}

